<script setup lang="ts">
const props = defineProps({
  activities: {
    type: Boolean,
    default: () => false,
  },
  title: {
    type: String,
    default: "",
  },
  time: {
    type: String,
    default: "",
  },
});
</script>

<template>
  <div class="time-line" :class="{ active: props.activities }">
    <div class="left">
      <span class="dot"></span>
    </div>
    <div class="right">
      <div class="header">
        <span class="title">{{ props.title }}</span>
        <!-- <span class="time">{{ props.time }}</span> -->
      </div>
      <div class="content">
        <slot></slot>
      </div>
    </div>
  </div>
</template>

<style scoped lang="scss">
.time-line {
  display: flex;
  align-items: flex-start;
  &.active {
    .left {
      .dot {
        background: #1dbf73;
        border: 1px solid #1dbf73;
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        &::before {
          content: "";
          display: block;
          width: 10px;
          height: 10px;
          border-radius: 50%;
          border: 1px solid #fff;
          background: #1dbf73;
        }
      }
    }
  }
  &:last-child {
    .right {
      &::before {
        content: "";
        position: absolute;
        display: block;
        top: 4px;
        left: -14px;
        width: 1px;
        height: 100%;
        border-right: none;
        z-index: 0;
      }
    }
  }
}
.left {
  display: flex;
  margin-right: 8px;
  .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(25, 30, 40, 0.12);
    background: #fff;
    position: relative;
    z-index: 1;
  }
}
.right {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-top: -4px;
  position: relative;
  &::before {
    content: "";
    position: absolute;
    display: block;
    top: 2px;
    left: -16px;
    width: 1px;
    height: 100%;
    border-right: 1px dotted rgba(25, 30, 40, 0.12);
    z-index: 0;
  }
  .header {
    flex: 1;
    display: flex;
    .title {
      color: rgba(25, 30, 40, 0.6);
      font-weight: bold;
      flex: 1;
    }
    .time {
      color: rgba(25, 30, 40, 0.48);
    }
  }
}
.content {
  padding-bottom: 12px;
  min-height: 32px;
}
</style>
